<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>template</title>
	</head>
	<body>
		<div id="app">
			数值1:<input type="text" name="num1" v-model="num1"/><br>
			数值2:<input type="text" name="num2" v-model="num2" @keyup.enter="addNum"/>
			<button @click="addNum">计算</button><br>
			总数: <span v-text="sum"></span>
			
		</div>
		<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
		<script>
			const app = new Vue({
				el: "#app",
				data: {
					num1: '',
					num2: '',
					sum : ''
				},
				methods:{
					addNum(){
						this.sum = parseInt(this.num1)+parseInt(this.num2)
					}
				}
			})
		</script>
	</body>
</html>
